<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="../templates/principal.xhtml">

    <ui:define name="head">
        <script type="text/javascript">
            function handleBaixaRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('baixaDialog').show();
                } else {
                    PF('baixaDialog').hide();
                }
            }

            function handleBaixaNfRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('baixaDialogNf').hide();
                } else {
                    PF('baixaDialogNf').show();
                }
            }

            function handleLancaRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('LancaDialog').show();
                } else {
                    PF('LancaDialog').hide();
                }
            }

            function handleAporteRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('AporteDialog').show();
                } else {
                    PF('AporteDialog').hide();
                }
            }

            function handleOSRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('propostaDialog').show();
                } else {
                    PF('propostaDialog').hide();
                }
                PF('propostaDialog').toggleMaximize();
            }

            function handleExcluirRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('confirmationExcluir').show();
                } else {
                    PF('confirmationExcluir').hide();
                }
            }

            function handleCancelaRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('confirmationCancela').show();
                } else {
                    PF('confirmationCancela').hide();
                }
            }

            function handleRetiraRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    PF('confirmation').show();
                } else {
                    PF('confirmation').hide();
                }
            }

            function handleJurosRequest(xhr, status, args) {
                if (args.validationFailed || args.loggedIn) {
                    PF('confirmationJuros').show();
                } else {
                    PF('baixaDialogNf').show();
                }
            }

            jQuery(function ($) {
                $("input.data:text").mask("99/99/9999");
                $("input.proposta:text").mask("999/9999");
            });
        </script>
    </ui:define>

    <ui:define name="content" id="content">
        <h:form id="frmProposta">
            <p:panel id="panel" header="Bem Vindo a Ordem de Serviço">
                <p:growl id="messages" life="5000" showDetail="true" />

                <p:tooltip />

                <p:dataTable id="tabProposta" widgetVar="wtabProposta" var="proposta" value="#{propostaBean.lazyModel}" 
                             lazy="true" paginator="true" rows="15" paginatorPosition="top" 
                             emptyMessage="Nenhum Registro Retornado ..." filterEvent="enter" resizableColumns="true">

                    <f:facet name="header">
                        STATUS: 8 - Ordem de Serviço
                    </f:facet>

                    <p:columnGroup type="header">
                        <p:row>
                            <p:column rowspan="3" headerText="Numero O.S." sortBy="#{proposta.numOs}" filterBy="#{proposta.numOs}" />
                        </p:row>
                        <p:row>
                            <p:column colspan="2" headerText="Datas" />
                            <p:column colspan="5" />
                        </p:row>
                        <p:row>
                            <p:column headerText="Ordem de Serviço" filterStyle="width:100px; text-align: center; " filterBy="#{proposta.datOs}" sortBy="#{proposta.datOs}" filterStyleClass="data" />
                            <p:column headerText="Finalizada/Cancelada" filterStyle="width:100px; text-align: center; " filterBy="#{proposta.datFechamento}" sortBy="#{proposta.datFechamento}" filterStyleClass="data" />
                            <p:column headerText="Empreendimento" sortBy="#{proposta.idEmpreendimento.dscEmpreendimento}" filterBy="#{proposta.idEmpreendimento.dscEmpreendimento}" /> 
                            <p:column headerText="Assunto" sortBy="#{proposta.dscProposta}" filterBy="#{proposta.dscProposta}" /> 
                            <p:column headerText="Empresa" sortBy="#{proposta.idEmpresa.nomEmpresa}" filterBy="#{proposta.idEmpresa.nomEmpresa}"
                                      filterOptions="#{propostaBean.empresaOptions}" filterMatchMode="exact" /> 
                            <p:column headerText="Cliente Nome Fantasia/Sobrenome" sortBy="#{proposta.idCliente.nomFantasia}" filterBy="#{proposta.idCliente.nomFantasia}" /> 
                            <p:column headerText="Status" sortBy="#{proposta.corStatus}" filterBy="#{proposta.corStatus}"  
                                      filterOptions="#{propostaBean.corStatusOptions}" filterMatchMode="exact" style="width: 10%;" /> 
                        </p:row>
                    </p:columnGroup>

                    <p:column style="text-align: center;">
                        <h:outputText value="#{proposta.numOs}" />
                    </p:column>

                    <p:column style="text-align: center;">
                        <h:outputText value="#{proposta.datOs}">
                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </p:column>

                    <p:column style="text-align: center;">
                        <h:outputText value="#{proposta.datFechamento}">
                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <div style="text-align: left; ">
                            <h:outputText value="#{proposta.idEmpreendimento.dscEmpreendimento}" />
                        </div>
                    </p:column>

                    <p:column>
                        <div style="text-align: left; ">
                            <h:outputText value="#{proposta.dscProposta}" />
                        </div>
                    </p:column>

                    <p:column>
                        <div style="text-align: left; ">
                            <h:outputText value="#{proposta.idEmpresa.nomEmpresa}" />
                        </div>
                    </p:column>

                    <p:column>
                        <div style="text-align: left; ">
                            <h:outputText value="#{proposta.idCliente.nomFantasia}" />
                        </div>
                    </p:column>

                    <p:column>
                        <p:panelGrid>
                            <p:row>
                                <p:column style="width: 10px; height: 10px; background-color: #{proposta.corStatus}; color: #ffffff;" />
                                <p:column>
                                    <p:commandButton id="selectButtonProposta" update=":frmProposta:panelDetalheValor :frmProposta:messages :frmProposta:panel" 
                                                     icon="ui-icon-search" title="Visualizar // Alterar Ordem de Serviço" oncomplete="PF('propostaDialog').show(); PF('propostaDialog').toggleMaximize();">
                                        <f:setPropertyActionListener value="#{proposta}" target="#{propostaBean.selectedProposta}" />
                                        <f:setPropertyActionListener value="#{false}" target="#{propostaBean.ativa}" />
                                    </p:commandButton>

                                    <p:commandButton id="selectButtonFinaliza" update=":frmProposta:panel :frmProposta:messages" 
                                                     icon="ui-icon-squaresmall-close" title="Finalizar Ordem de Serviço" oncomplete="PF('cancelaOs').show();">
                                        <f:setPropertyActionListener value="#{proposta}" target="#{propostaBean.selectedProposta}" />
                                        <f:setPropertyActionListener value="#{'A'}" target="#{propostaBean.ctipstatus}" />
                                    </p:commandButton>

                                    <p:commandButton id="selectButtonCancela" update=":frmProposta:panel :frmProposta:messages" 
                                                     icon="ui-icon-cancel" title="Cancelar Ordem de Serviço" oncomplete="PF('cancelaOs').show();">
                                        <f:setPropertyActionListener value="#{proposta}" target="#{propostaBean.selectedProposta}" />
                                        <f:setPropertyActionListener value="#{'0'}" target="#{propostaBean.ctipstatus}" />
                                    </p:commandButton>
                                </p:column>
                            </p:row>
                        </p:panelGrid>
                    </p:column>
                </p:dataTable>

                <!-- DETALHES O.S. -->
                <p:dialog id="dialog" header="Detalhes Ordem de Serviço" widgetVar="propostaDialog" resizable="true" 
                          onHide="PF('propostaDialog').toggleMaximize();" closable="true"
                          showEffect="explode" hideEffect="explode" style="text-align: left" position="top" maximizable="true">
                    <p:panel id="panelDetalheValor">
                        <p:panelGrid id="displaytab1" style="text-align: left; width: 100%;">

                            <p:row>
                                <p:column>
                                    <h:outputText value="* Numero Ordem de Serviço:" />
                                </p:column>
                                <p:column>
                                    <p:inputMask value="#{propostaBean.selectedProposta.numOs}" mask="999/9999" style="font-weight:bold;" />
                                </p:column>

                                <p:column>
                                    <h:outputText value="Status O.S.:" />
                                </p:column>
                                <p:column colspan="2" style="background-color: #{propostaBean.selectedProposta.corStatus}; color: white;">
                                    <p:outputLabel value="#{propostaBean.selectedProposta.dscCorStatus}" style="width:500px; font-weight:bold;" />
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="* Assunto:" />
                                </p:column>
                                <p:column colspan="3">
                                    <p:outputLabel id="inDescricao" value="#{propostaBean.selectedProposta.dscProposta}" style="width:800px; font-weight:bold; " />
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="Empresa:" />
                                </p:column>
                                <p:column colspan="4">
                                    <p:outputLabel id="inEmpresa" value="#{propostaBean.selectedProposta.idEmpresa.nomEmpresa}" style="width:800px; font-weight:bold; " />
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="* Cliente:" />
                                </p:column>
                                <p:column>
                                    <p:outputLabel id="inCliente" value="#{propostaBean.selectedProposta.idCliente.nomCliente}" 
                                                   style="width:500px; font-weight:bold; " />
                                </p:column>
                                <p:column>
                                    <h:outputText value="Empreendimento:" />
                                </p:column>
                                <p:column colspan="2">
                                    <p:outputLabel id="inEmpreendimento" value="#{propostaBean.selectedProposta.nomEmpreendimento}" 
                                                   style="width:500px; font-weight:bold;" />
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="Endereços:" />
                                </p:column>

                                <p:column>
                                    <ui:repeat value="#{propostaBean.selectedProposta.idEmpreendimento.empreendimentoEnderecoList}" var="end">
                                        <h:outputText value="#{end.codLogradouro.dscLogradouro}, #{end.numEndereco} #{end.dscComplemento} - " style="font-weight:bold;" />
                                    </ui:repeat>
                                </p:column>

                                <p:column>
                                    <h:outputText value="Cidade:" />
                                </p:column>

                                <p:column colspan="2">
                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpreendimento.empreendimentoEnderecoList.get(0).codLogradouro.codBairro.codCidade.dscCidade}" style="font-weight:bold;" />
                                </p:column>
                            </p:row>

                            <p:row> 
                                <p:column>
                                    <h:outputText value="Data Ordem de Serviço:" />
                                </p:column>
                                <p:column colspan="3">
                                    <p:inputMask id="imDatAbert" value="#{propostaBean.selectedProposta.datOs}" mask="99/99/9999" style="font-weight:bold; ">
                                        <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                    </p:inputMask>
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="* Centro de Controle:" />
                                </p:column>
                                <p:column colspan="3">
                                    <h:outputText id="inCusto" value="#{propostaBean.selectedProposta.idEmpreendimento.idCusto.dscCusto}" style="width:500px; font-weight:bold;" />
                                </p:column>
                            </p:row>

                            <p:row>
                                <p:column>
                                    <h:outputText value="Observações:" />
                                </p:column>
                                <p:column colspan="3">
                                    <p:inputTextarea autoResize="false"  value="#{propostaBean.selectedProposta.ordObs}" style="font-weight:bold; width: 80%; height: 15px;  " />
                                    <p:commandButton id="btCancelar" value="Cancelar Etapa(s)" title="Selecione as Linhas e clique para Efetuar o Cancelamento"
                                                     update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-cancel" oncomplete="PF('confirmationCancela').show();" />
                                </p:column>
                            </p:row>
                        </p:panelGrid>
                        <p:tabView id="tabView" dynamic="true" activeIndex="#{propostaBean.tabindex}">
                            <p:tab title="Etapas - Honorários" id="tab1">
                                <p:dataTable var="etapa" value="#{propostaBean.selectedProposta.propostaValorList}" rows="2" paginator="true"  resizableColumns="true"
                                             id="tabPropostaValor"  emptyMessage="ATENÇÃO ... Nenhuma Etapa - Escopos/Honorários Cadastrados ..." 
                                             paginatorPosition="top">

                                    <f:facet name="header">
                                        <h:outputText value="   Base de Calculo:  " />
                                        <p:inputText id="inBaseCalculoInicial" value="#{propostaBean.baseCalculoInicial}" style="font-weight:bold; text-align: right; width: 100px;"
                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)" readonly="true">
                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                        </p:inputText>

                                        <p:commandButton id="btBaixaChama" value="Finalizar" title="Selecione as Linhas e clique para Efetuar a Finalização" 
                                                         update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-disk" oncomplete="PF('baixaDialog').show();" />

                                        <p:commandButton id="btBaixaRetira" value="Retirar Finalização // Cancelamento // Nota Fiscal" title="Selecione as Linhas e clique para Efetuar a Retirada da Finalização, Cancelamento  e/ou Nota Fiscal"
                                                         update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-trash" oncomplete="PF('confirmation').show();" />

                                        <p:commandButton id="btAporte" value="Criar Aporte" title="Clique para criar novo Aporte" action="#{propostaBean.criarAporte()}"
                                                         update=":frmProposta:panelDetalheValor :frmProposta:gridAporte :frmProposta:messages" icon="ui-icon-bullet" oncomplete="PF('AporteDialog').show();" />

                                        <p:commandButton id="btAporteRetira" value="Retirar Linha(s)" title="Selecione as Linhas e clique para Efetuar a Retirada da(s) Linhas"
                                                         update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-trash" oncomplete="PF('confirmationExcluir').show();" />

                                        <p:commandButton id="btNotaChama" value="Lançar Nota" title="Selecione as Linhas e clique para Lançar a Nota Fiscal"
                                                         update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-disk" oncomplete="PF('LancaDialog').show();" />
                                    </f:facet>

                                    <p:column headerText="ETAPA" style="width: 50px;"><h:outputText value="#{etapa.dscEtapa}" /></p:column>
                                    <p:column headerText="ASSUNTO" style="width: 100px;"><h:outputText value="#{etapa.dscAssunto}" /></p:column>
                                    <p:column headerText="VALOR" style="font-weight:bold; text-align: right; width: 100px;">
                                        <h:outputText value="#{etapa.vlrEtapa}" style="font-weight:bold; text-align: right;">
                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                        </h:outputText>
                                    </p:column>

                                    <p:column>
                                        <p:dataTable var="etapaPerc" value="#{etapa.propostaValorPercList}" rows="2" paginator="true" id="gridEtapaPerc" resizableColumns="true"
                                                     editable="true" rowIndexVar="rowId" emptyMessage="ATENÇÃO ... Nenhuma Etapa - Escopos/Honorários Cadastrados ..." paginatorPosition="top">

                                            <p:column headerText="% Pagto" style="font-weight:bold; text-align: right; width: 60px;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.percEtapa}" converter="percentualConverter" />
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.percEtapa}" style="width: 60px; font-weight:bold; text-align: right;" converter="percentualConverter" />
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Evento" style="font-weight:bold;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.dscPerc}" />
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.dscPerc}" style="width: 300px; font-weight:bold;" />
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column> 

                                            <p:column headerText="Nota Fiscal" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.dscNfe}" />
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.dscNfe}" style="width: 80px; text-align: left; font-weight:bold;" />
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Data Emissão" style="font-weight:bold; text-align: center;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.datEmissao}">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputMask value="#{etapaPerc.datEmissao}" mask="99/99/9999" style="width: 80px; font-weight:bold;">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </p:inputMask>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Data Vencimento" style="font-weight:bold; text-align: center;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.datVencNota}">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputMask value="#{etapaPerc.datVencNota}" mask="99/99/9999" style="width: 80px; font-weight:bold;">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </p:inputMask>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Valor Bruto" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.vlrProposta}">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.vlrProposta}" 
                                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                                                     style="font-weight:bold; text-align: right; width: 100px;">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </p:inputText>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Valor Juros" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.vlrJuros}">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.vlrJuros}" 
                                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                                                     style="font-weight:bold; text-align: right; width: 100px;">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </p:inputText>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Valor Multa" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.vlrMulta}">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.vlrMulta}" 
                                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                                                     style="font-weight:bold; text-align: right; width: 100px;">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </p:inputText>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Valor Recebido" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.vlrPago}">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.vlrPago}" 
                                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                                                     style="font-weight:bold; text-align: right; width: 100px;">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </p:inputText>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Valor Terceiro" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.vlrLiquido}">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputText value="#{etapaPerc.vlrLiquido}" 
                                                                     onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                                                     style="font-weight:bold; text-align: right; width: 100px;">
                                                            <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                        </p:inputText>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Data Pagamento" style="font-weight:bold; text-align: right;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.datPagamento}">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </h:outputText>
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:inputMask value="#{etapaPerc.datPagamento}" mask="99/99/9999" style="width: 80px; font-weight:bold;">
                                                            <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                                        </p:inputMask>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Status Etapa" style="width: 150px; font-weight:bold; text-align: center;">
                                                <p:cellEditor>
                                                    <f:facet name="output">
                                                        <h:outputText value="#{etapaPerc.dscOrdStatus}" />
                                                    </f:facet>

                                                    <f:facet name="input">
                                                        <p:selectOneMenu value="#{etapaPerc.ordStatus}" style="width: 150px; font-weight:bold;">
                                                            <f:selectItem itemLabel="A Faturar" itemValue="A" />
                                                            <f:selectItem itemLabel="Faturado não Pago" itemValue="F" />
                                                            <f:selectItem itemLabel="Faturado Pago" itemValue="P" />
                                                            <f:selectItem itemLabel="Cancelado" itemValue="C" />
                                                        </p:selectOneMenu>
                                                    </f:facet>
                                                </p:cellEditor>
                                            </p:column>

                                            <p:column headerText="Calcula" style="font-weight:bold; text-align: center;">
                                                <p:selectBooleanButton value="#{etapaPerc.calcula}" onLabel="Sim" offLabel="Não" onIcon="ui-icon-check" offIcon="ui-icon-close">
                                                    <p:ajax update=":frmProposta:panelDetalheValor :frmProposta:tabView" listener="#{propostaBean.somatotal}" />
                                                </p:selectBooleanButton>
                                            </p:column>

                                            <p:column style="width:2%;">
                                                <p:rowEditor />
                                            </p:column>
                                        </p:dataTable>
                                    </p:column>
                                </p:dataTable>

                                <p:panelGrid id="panelTotal" style="width: 100%;">
                                    <f:facet name="header">  
                                        <p:row>
                                            <p:column colspan="6">TOTAL GERAL</p:column>
                                        </p:row>
                                        <p:row>
                                            <p:column>Valor Etapas</p:column>
                                            <p:column>Valor Bruto</p:column>
                                            <p:column>Valor Terceiro</p:column>
                                            <p:column>Custo I.S.S.</p:column>
                                            <p:column>Valor Recebido</p:column>
                                            <p:column>Valor a Receber Bruto</p:column>
                                        </p:row>
                                    </f:facet>
                                    <p:row>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.totalEtapa}" >
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.totalBruto}" style="font-weight:bold; text-align: right;">
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.totalLiquido}" style="font-weight:bold; text-align: right;">
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.custoIss}" style="font-weight:bold; text-align: right;">
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.totalRecebido}" style="font-weight:bold; text-align: right;">
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                        <p:column style="font-weight:bold; text-align: right;">
                                            <h:outputText value="#{propostaBean.selectedProposta.totalReceber}" style="font-weight:bold; text-align: right;">
                                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                            </h:outputText>
                                        </p:column>
                                    </p:row>
                                </p:panelGrid> 
                            </p:tab>
                            <p:tab title="Calculo Impostos" id="tab2">
                                <p:tabView id="tabView2" dynamic="true">
                                    <p:tab title="Calculo Menor" id="tab12">
                                        <p:panelGrid style="width: 100%;">
                                            <f:facet name="header">
                                                <p:row>
                                                    <p:column colspan="7" style="text-align: center; font-weight:bold;">CALCULO MENOR</p:column>
                                                </p:row>
                                                <p:row>
                                                    <p:column colspan="3" style="text-align: center; font-weight:bold;">IMPOSTOS</p:column>
                                                    <p:column colspan="2" style="text-align: center; font-weight:bold;">NOTA</p:column>
                                                    <p:column colspan="2" style="text-align: center; font-weight:bold;">EMPRESA</p:column>
                                                </p:row>
                                            </f:facet>
                                            <p:row>
                                                <p:column style="font-weight:bold;">Base de Calculo</p:column>
                                                <p:column colspan="7">
                                                    <p:inputText id="inBaseCalculo" value="#{propostaBean.baseCalculo}" style="font-weight:bold; text-align: right; width: 100px;"
                                                                 onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </p:inputText>
                                                    <p:commandButton id="selectButtonCalculo" update=":frmProposta:panelDetalheValor :frmProposta:messages" 
                                                                     icon="ui-icon-calculator" title="Calcular Impostos" actionListener="#{propostaBean.Basecalculo}" />
                                                </p:column>
                                            </p:row>
                                            <!-- INICIO COFINS -->
                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalPercConfins}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="font-weight:bold;">COFINS</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfins}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCofins}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfinsNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCofins_triunfo}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfinsTriunfo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- FIM COFINS -->

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercPis}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">PIS</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPis}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percPis}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPisNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percPis_triunfo}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPisTriunfo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercCsl}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">C.S.L.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCsl}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCsl}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCslNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCsl_triunfo}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCslTriunfo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercIr}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">I.R.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIr}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIr}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIr_triunfo}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrTriunfo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercIss}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">I.S.S.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIss}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIss}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIssNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText style="font-weight:bold;" value="FIXO TRIMESTRAL" rendered="#{propostaBean.selectedProposta.idEmpresa.tipCalculoIss == 'F'}" />
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIss_triunfo}" converter="percentualConverter" rendered="#{propostaBean.selectedProposta.idEmpresa.tipCalculoIss == 'P'}" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIssTriunfo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- INICIO RESUMO -->
                                            <p:row>
                                                <p:column colspan="7"></p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">Impostos</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostos}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosEmpresa}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">Valor Bruto</p:column>
                                                <p:column style="text-align: right; font-weight:bold;">
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="text-align: right; font-weight:bold;">
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>    
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: center;">Carnê</p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column colspan="7" style="background-color: #CCCCCC;"></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">SERVIÇO</p:column>
                                                <p:column style="font-weight:bold; text-align: right;" >
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">IR</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">PIS/COF/CS</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosServico}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">RETIDO</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosRetido}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">TOTAL NOTA</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">LIQUIDO</p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalLiquido}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- FINAL RESUMO -->
                                        </p:panelGrid>
                                    </p:tab>
                                    <p:tab title="Calculo Maior" id="tab13">
                                        <p:panelGrid style="width: 100%;">
                                            <f:facet name="header">
                                                <p:row>
                                                    <p:column colspan="7" style="text-align: center; font-weight:bold;">CALCULO MAIOR</p:column>
                                                </p:row>
                                                <p:row>
                                                    <p:column colspan="3" style="text-align: center; font-weight:bold;">IMPOSTOS</p:column>
                                                    <p:column colspan="2" style="text-align: center; font-weight:bold;">NOTA</p:column>
                                                    <p:column colspan="2" style="text-align: center; font-weight:bold;">EMPRESA</p:column>
                                                </p:row>
                                            </f:facet>
                                            <p:row>
                                                <p:column style="font-weight:bold;">Base de Calculo</p:column>
                                                <p:column colspan="7">
                                                    <p:inputText id="inBaseCalculo2" value="#{propostaBean.baseCalculoMaior}" style="font-weight:bold; text-align: right; width: 100px;"
                                                                 onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </p:inputText>
                                                    <p:commandButton id="selectButtonCalculo2" update=":frmProposta:panelDetalheValor :frmProposta:messages" 
                                                                     icon="ui-icon-calculator" title="Calcular Impostos" actionListener="#{propostaBean.BasecalculoMaior}" />
                                                </p:column>
                                            </p:row>
                                            <!-- INICIO COFINS -->
                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalPercConfinsMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="font-weight:bold;">COFINS</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfinsMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCofinsMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfinsNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCofins_triunfoMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrConfinsTriunfoMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- FIM COFINS -->

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercPisMaior}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">PIS</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPisMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percPisMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPisNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percPis_triunfoMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrPisTriunfoMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercCslMaior}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">C.S.L.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCslMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCslMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCslNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percCsl_triunfoMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrCslTriunfoMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercIrMaior}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">I.R.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIrMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIr_triunfoMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrTriunfoMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <p:row>
                                                <p:column style="text-align: right;">
                                                    <p:column style="text-align: right;">
                                                        <h:outputText value="#{propostaBean.selectedProposta.totalPercIssMaior}" converter="percentualConverter" />
                                                    </p:column>
                                                </p:column>
                                                <p:column style="font-weight:bold;">I.S.S.</p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIssMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIssMaior}" converter="percentualConverter" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIssNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText style="font-weight:bold;" value="FIXO TRIMESTRAL" rendered="#{propostaBean.selectedProposta.idEmpresa.tipCalculoIssMaior == 'F'}" />
                                                    <h:outputText value="#{propostaBean.selectedProposta.idEmpresa.percIss_triunfo}" converter="percentualConverter" rendered="#{propostaBean.selectedProposta.idEmpresa.tipCalculoIssMaior == 'P'}" />
                                                </p:column>
                                                <p:column style="text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIssTriunfoMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- INICIO RESUMO -->
                                            <p:row>
                                                <p:column colspan="7"></p:column>
                                            </p:row>

                                            <p:row>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">Impostos</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostos}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosEmpresa}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">Valor Bruto</p:column>
                                                <p:column style="text-align: right; font-weight:bold;">
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="text-align: right; font-weight:bold;">
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>    
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: center;">Carnê</p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column colspan="7" style="background-color: #CCCCCC;"></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">SERVIÇO</p:column>
                                                <p:column style="font-weight:bold; text-align: right;" >
                                                    <h:outputText value="#{propostaBean.baseCalculo}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">IR</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.selectedProposta.totalVlrIrNotaMaior}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">PIS/COF/CS</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosServico}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">RETIDO</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalImpostosRetido}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">TOTAL NOTA</p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalNota}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                            </p:row>
                                            <p:row>

                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold;">LIQUIDO</p:column>
                                                <p:column></p:column>
                                                <p:column></p:column>
                                                <p:column style="font-weight:bold; text-align: right;">
                                                    <h:outputText value="#{propostaBean.totalLiquido}">
                                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                                    </h:outputText>
                                                </p:column>
                                            </p:row>
                                            <!-- FINAL RESUMO -->
                                        </p:panelGrid>
                                    </p:tab>
                                </p:tabView>
                            </p:tab>

                        </p:tabView>
                    </p:panel>
                    <div style="text-align: left;">
                        <p:commandButton value="Gravar" rendered="#{!propostaBean.ativa}" title="Grava as Alterações Efetuadas"
                                         update=":frmProposta:panel :frmProposta:messages" icon="ui-icon-disk" 
                                         oncomplete="handleOSRequest(xhr, status, args);" actionListener="#{propostaBean.alterar}" />

                        <p:commandButton value="Finalizar O.S." id="selectButtonFinaliza2" icon="ui-icon-squaresmall-close" title="Finalizar Ordem de Serviço" oncomplete="PF('cancelaOs').show();">
                            <f:setPropertyActionListener value="#{'A'}" target="#{propostaBean.ctipstatus}" />
                        </p:commandButton>

                        <p:commandButton value="Cancelar O.S." id="selectButtonCancela2" icon="ui-icon-cancel" title="Cancelar Ordem de Serviço" oncomplete="PF('cancelaOs').show();">
                            <f:setPropertyActionListener value="#{'0'}" target="#{propostaBean.ctipstatus}" />
                        </p:commandButton>

                        <p:commandButton value="Retornar Finalizar/Cancelar O.S." id="selectButtonCancela3" icon="ui-icon-cancel" title="Retornar o Status da Ordem de Serviço para: Em Andamento" oncomplete="PF('cancelaOs').show();">
                            <f:setPropertyActionListener value="#{'8'}" target="#{propostaBean.ctipstatus}" />
                        </p:commandButton>

                        <p:commandButton icon="ui-icon-closethick" value="Fechar" update=":frmProposta:panel :frmProposta:messages" onclick="PF('propostaDialog').hide();" title="Fecha Janela das Ordens de Serviço!" />
                    </div>
                </p:dialog>

                <!-- Dialog para Inserir os Dados da Baixa -->
                <p:dialog id="dialogBaixa" header="Detalhes da Finalização de Nota Fiscal" widgetVar="baixaDialog" resizable="true"
                          showEffect="explode" hideEffect="explode" position="top"  maximizable="true">

                    <p:panelGrid columns="2" id="gridBaixa">
                        <p:column>
                            <h:outputLabel for="inNota" value="Numero da Nota: *" />
                        </p:column>
                        <p:column>
                            <p:inputText id="inNota" value="#{propostaBean.numNota2}" label="Nota" />
                        </p:column>

                        <p:column>
                            <h:outputLabel for="inDataEmissao" value="Data Emissão: *" />
                        </p:column>
                        <p:column>
                            <p:inputMask id="inDataEmissao" label="DataEmissao" value="#{propostaBean.dataEmissao2}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel for="inDataVencimento" value="Data Vencimento: *" />
                        </p:column>
                        <p:column>
                            <p:inputMask id="inDataVencimento" label="DataVencimento" value="#{propostaBean.dataVencimento2}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel for="inDataPagamento" value="Data Pagamento: *" />
                        </p:column>
                        <p:column>
                            <p:inputMask id="inDataPagamento" label="DataPagamento" value="#{propostaBean.dataPagamento2}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <f:facet name="footer">
                            <div style="text-align: right;">
                                <p:commandButton id="btBaixa" value="Confirmar Finalização" title="Clique para Efetuar a Finalização" actionListener="#{propostaBean.verificaBaixa}" 
                                                 oncomplete="handleJurosRequest(xhr, status, args);" update=":frmProposta:outNf :frmProposta:pnConsole :frmProposta:messages" icon="ui-icon-check"  />
                            </div>
                        </f:facet>
                    </p:panelGrid>
                </p:dialog>

                <!-- Dialog GRID das N.F. -->
                <p:dialog id="dialogBaixaNf" header="Detalhes da Finalização de Nota Fiscal" widgetVar="baixaDialogNf" resizable="true"
                          showEffect="explode" hideEffect="explode" maximizable="true" position="left,center">

                    <p:outputPanel id="outNf" deferred="true" deferredMode="visible">
                        <p:dataTable id="tabNf" widgetVar="wtabNf" var="nf" value="#{propostaBean.listViewNota}" 
                                     paginator="true" rows="15" paginatorPosition="top" emptyMessage="NENHUMA NOTA FISCAL FATURADA NESTE MÊS ...">

                            <p:columnGroup type="header">
                                <p:row>
                                    <p:column headerText="Mês/Ano" />

                                    <p:column headerText="No. Ordem de Serviço" style="text-align: center;"/>

                                    <p:column headerText="Status Ordem de Serviço" style="width: 200px;" />

                                    <p:column headerText="No. Nota Fiscal" style="width: 200px;" />

                                    <p:column headerText="Assunto" style="width: 200px;" />

                                    <p:column headerText="Evento" />

                                    <p:column headerText="Data de Emissão" />

                                    <p:column headerText="Data Vencimento" />

                                    <p:column headerText="Valor Bruto" />

                                    <p:column headerText="Valor Juros" />

                                    <p:column headerText="Valor Multa" />

                                    <p:column headerText="Valor Recebido" />

                                    <p:column headerText="Valor Terceiro" />

                                    <p:column headerText="Data Pagamento" />

                                    <p:column headerText="Status Etapa" />
                                </p:row>

                                <p:row>
                                    <p:column headerText="Razão Social/Nome" />
                                    <p:column headerText="Fantasia Sobrenome"/>
                                    <p:column headerText="C.N.P.J./C.P.F. Cliente" style="width: 200px;"/>
                                    <p:column headerText="Empreendimento" style="width: 200px;"/>
                                    <p:column headerText="C.N.P.J./C.P.F. Empreendimento" style="width: 200px;"/>
                                    <p:column colspan="10" />
                                </p:row>
                            </p:columnGroup>

                            <p:column style="text-align: center; font-weight:bold;">
                                <h:outputText value="#{nf.mesano}" />
                                <br />
                                <h:outputText value="#{nf.nomCliente}" />
                            </p:column>

                            <p:column style="text-align: center;">
                                <h:outputText value="#{nf.numOs}" />
                                <br />
                                <h:outputText value="#{nf.nomFantasia}" />
                            </p:column>

                            <p:column style="text-align: center; font-weight:bold; width: 200px;">
                                <h:outputText value="#{nf.dscStatus}" />
                                <br />
                                <h:outputText value="#{nf.numCpf}" />
                            </p:column>

                            <p:column style="text-align: center;">
                                <h:outputText value="#{nf.dscNfe}" />
                                <br />
                                <h:outputText value="#{nf.dscEmpreendimento}" />
                            </p:column>

                            <p:column style="text-align: center; width: 200px;">
                                <h:outputText value="#{nf.dscAssunto}" />
                                <br />
                                <h:outputText value="#{nf.numCpfEmpreendimento}" />
                            </p:column>

                            <p:column style="text-align: center;">
                                <h:outputText value="#{nf.dscPerc}" />
                            </p:column>

                            <p:column style="text-align: center; font-weight:bold;">
                                <h:outputText value="#{nf.datEmissao}">
                                    <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: center;">
                                <h:outputText value="#{nf.datVencNota}">
                                    <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: right;">
                                <h:outputText value="#{nf.vlrProposta}">
                                    <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: right;">
                                <h:outputText value="#{nf.vlrJuros}">
                                    <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: right;">
                                <h:outputText value="#{nf.vlrMulta}">
                                    <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: right;">
                                <h:outputText value="#{nf.vlrPago}">
                                    <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: right;">
                                <h:outputText value="#{nf.vlrLiquido}">
                                    <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: center;">
                                <h:outputText value="#{nf.datPagamento}">
                                    <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>

                            <p:column style="font-weight:bold; text-align: left;">
                                <h:outputText value="#{nf.dscOrdStatus}" />
                            </p:column>
                        </p:dataTable>

                        <p:panelGrid id="pnConsole" style="width: 100%;">
                            <p:row>
                                <p:column>
                                    <p:outputLabel for="console" value="Tipo de Cálculo:" style="font-weight:bold;" />
                                </p:column>
                                <p:column>
                                    <p:selectOneRadio id="console" value="#{propostaBean.console}">
                                        <f:selectItem itemLabel=" - Calcular a Menor" itemValue="CN" />
                                        <f:selectItem itemLabel=" - Calcular a Maior" itemValue="CM" />
                                    </p:selectOneRadio>
                                </p:column>

                                <p:column>
                                    <p:outputLabel for="inBaseCalculoInicialTemp" value="Base de Calculo:" style="font-weight:bold;" />
                                </p:column>
                                <p:column>
                                    <p:inputText id="inBaseCalculoInicialTemp" value="#{propostaBean.baseCalculoInicialTemp}" style="font-weight:bold; text-align: right; width: 100px;"
                                                 onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)">
                                        <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                                    </p:inputText>
                                </p:column>

                                <p:column>
                                    <p:commandButton id="btBaixaNf" value="Efetivar Finalização" title="Clique para Gravar a Finalização" actionListener="#{propostaBean.onEditValor}" 
                                                     update=":frmProposta:panelDetalheValor :frmProposta:messages" icon="ui-icon-disk"  />
                                </p:column>
                            </p:row>
                        </p:panelGrid>
                    </p:outputPanel>
                </p:dialog>

                <!-- Dialog para Inserir os Dados da Nota Fiscal -->
                <p:dialog id="dialogLanca" header="Detalhes do Lançamento da Nota Fiscal" widgetVar="LancaDialog" resizable="true"
                          showEffect="explode" hideEffect="explode" position="top">

                    <p:panelGrid columns="2" id="gridLanca">
                        <p:column>
                            <h:outputLabel for="inNotaLanca" value="Numero da Nota: *" />
                        </p:column>
                        <p:column>
                            <p:inputText id="inNotaLanca" value="#{propostaBean.numNota3}" label="Nota" />
                        </p:column>

                        <p:column>
                            <h:outputLabel for="inDataEmissaoLanca" value="Data Emissão: *" />
                        </p:column>
                        <p:column>
                            <p:inputMask id="inDataEmissaoLanca" label="DataEmissao" value="#{propostaBean.dataEmissao3}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel for="inDataVencimentoLanca" value="Data Vencimento:" />
                        </p:column>
                        <p:column>
                            <p:inputMask id="inDataVencimentoLanca" label="DataVencimento" value="#{propostaBean.dataVencimento3}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <f:facet name="footer">
                            <div style="text-align: right;">
                                <p:commandButton id="btLanca" value="Efetuar Lançamento" title="Clique para Efetuar o Lançamento da Nota Fiscal" actionListener="#{propostaBean.onEditLanca}" 
                                                 oncomplete="handleLancaRequest(xhr, status, args);" update=":frmProposta:panelDetalheValor :frmProposta:gridLanca :frmProposta:messages" icon="ui-icon-disk"  /> 
                            </div>
                        </f:facet>
                    </p:panelGrid>
                </p:dialog>

                <!-- Dialog para Inserir os Dados do Aporte -->
                <p:dialog id="dialogAporte" header="Detalhes do Aporte" widgetVar="AporteDialog" resizable="true"
                          showEffect="explode" hideEffect="explode" position="top">

                    <p:panelGrid columns="2" id="gridAporte">
                        <p:column>
                            <h:outputLabel value="Numero Etapa: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorTemp.numEtapa}" 
                                         onkeyup="javascript:maskIt(this, event, '###', true)"
                                         style="font-weight:bold; text-align: right; width: 30px;">
                                <f:convertNumber locale="pt_BR" pattern="###" minFractionDigits="0" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Etapa: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorTemp.dscEtapa}" maxlength="200" style="font-weight:bold;  width: 300px;" />
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Assunto: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorTemp.dscAssunto}" maxlength="200" style="font-weight:bold;   width: 500px;" />
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorTemp.vlrEtapa}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputText value="Percentual: *" />
                        </p:column>
                        <p:column>
                            <p:inputText id="inPercentual" value="#{propostaBean.selectedPropostaValorPercTemp.percEtapa}" style="font-weight:bold; text-align: right;" converter="percentualConverter" />
                        </p:column>

                        <p:column>
                            <h:outputText value="Evento: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.dscPerc}" maxlength="200" style="font-weight:bold;  width: 500px;" />
                        </p:column>

                        <p:column>
                            <h:outputText value="Nota Fiscal:" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.dscNfe}" maxlength="200" style="font-weight:bold; width: 100px;" />
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Data Emissão:" />
                        </p:column>
                        <p:column>
                            <p:inputMask value="#{propostaBean.selectedPropostaValorPercTemp.datEmissao}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Data Vencimento:" />
                        </p:column>
                        <p:column>
                            <p:inputMask value="#{propostaBean.selectedPropostaValorPercTemp.datVencNota}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Bruto: *" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrProposta}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Juros: " />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrJuros}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Multa: " />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrMulta}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Terceiro:" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrLiquido}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Recebido:" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrPago}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Valor Impostos:" />
                        </p:column>
                        <p:column>
                            <p:inputText value="#{propostaBean.selectedPropostaValorPercTemp.vlrImposto}" 
                                         onkeyup="javascript:maskIt(this, event, '###.###.###,##', true)"
                                         style="font-weight:bold; text-align: right; width: 200px;">
                                <f:convertNumber locale="pt_BR" pattern="###,###,##0.00" minFractionDigits="2" />
                            </p:inputText>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Data Pagamento: " />
                        </p:column>
                        <p:column>
                            <p:inputMask value="#{propostaBean.selectedPropostaValorPercTemp.datPagamento}" mask="99/99/9999" style="font-weight:bold;">
                                <f:convertDateTime type="date" dateStyle="short" pattern="dd/MM/yyyy" />
                            </p:inputMask>
                        </p:column>

                        <p:column>
                            <h:outputLabel value="Status: *" />
                        </p:column>
                        <p:column>
                            <p:selectOneMenu value="#{propostaBean.selectedPropostaValorPercTemp.ordStatus}">
                                <f:selectItem itemLabel="A Faturar" itemValue="A" />
                                <f:selectItem itemLabel="Faturado não Pago" itemValue="F" />
                                <f:selectItem itemLabel="Faturado Pago" itemValue="P" />
                                <f:selectItem itemLabel="Cancelado" itemValue="C" />
                            </p:selectOneMenu>
                        </p:column>

                        <f:facet name="footer">
                            <div style="text-align: right;">
                                <p:commandButton id="btAporte" value="Efetuar Aporte" title="Clique para Efetuar a Finalização" actionListener="#{propostaBean.onEditAporte}" 
                                                 oncomplete="handleAporteRequest(xhr, status, args);" update=":frmProposta:panelDetalheValor :frmProposta:gridAporte :frmProposta:messages" icon="ui-icon-disk"  /> 
                            </div>
                        </f:facet>
                    </p:panelGrid>
                </p:dialog>

                <!-- CONFIRMA CANCELAMENTO O.S. -->
                <p:dialog header="Confirma Finalização/Cancelamento da O.S.? #{propostaBean.selectedProposta.numOs}" widgetVar="cancelaOs">

                    <p:commandButton value="Sim" update=":frmProposta:panel :frmProposta:messages" oncomplete="PF('cancelaOs').hide(); PF('propostaDialog').hide();"
                                     actionListener="#{propostaBean.cancelaOS}" />
                    <p:commandButton value="Não" onclick="PF('cancelaOs').hide();" type="button" />

                </p:dialog>

                <!-- CONFIRMA RETIRADA DE BAIXA -->
                <p:dialog header="Confirma a Retirada dessa Finalização/Cancelamento/Nota Fiscal?" widgetVar="confirmation">

                    <p:commandButton value="Sim" update=":frmProposta:panelDetalheValor :frmProposta:messages" oncomplete="handleRetiraRequest(xhr, status, args);"
                                     actionListener="#{propostaBean.retirarBaixa}" />
                    <p:commandButton value="Não" onclick="PF('confirmation').hide();" type="button" />

                </p:dialog>

                <!-- CONFIRMA RETIRADA DE LINHA -->
                <p:dialog header="Confirma a Retirada dessa(s) Linha(s)?" widgetVar="confirmationExcluir">

                    <p:commandButton value="Sim" update=":frmProposta:panelDetalheValor :frmProposta:messages" 
                                     actionListener="#{propostaBean.retirarLinha}" oncomplete="handleExcluirRequest(xhr, status, args);" />
                    <p:commandButton value="Não" onclick="PF('confirmationExcluir').hide();" type="button" />

                </p:dialog>

                <!-- CONFIRMA CANCELAMENTO DE ETAPAS -->
                <p:dialog header="Confirma o Cancelamento da(s) Etapa(s) ?" widgetVar="confirmationCancela">

                    <p:commandButton value="Sim" update=":frmProposta:panelDetalheValor :frmProposta:tabView:panelTotal :frmProposta:messages" 
                                     actionListener="#{propostaBean.cancelaEtapa}" oncomplete="handleCancelaRequest(xhr, status, args);" />
                    <p:commandButton value="Não" onclick="PF('confirmationCancela').hide()" type="button" />

                </p:dialog>

                <!-- CONFIRMA CALCULO JUROS -->
                <p:dialog header="Etapa(s) com Atraso, Deseja Efetuar os Calculos ?" widgetVar="confirmationJuros">

                    <p:commandButton value="Sim" update=":frmProposta:panelDetalheValor :frmProposta:tabView:panelTotal :frmProposta:messages" 
                                     action="#{propostaBean.sinalizaCalculo(true)}" oncomplete="PF('confirmationJuros').hide(); PF('baixaDialogNf').show();" />

                    <p:commandButton value="Não" update=":frmProposta:panelDetalheValor :frmProposta:tabView:panelTotal :frmProposta:messages" 
                                      action="#{propostaBean.sinalizaCalculo(false)}" oncomplete="PF('confirmationJuros').hide(); PF('baixaDialogNf').show();" />

                </p:dialog>

            </p:panel>

        </h:form>
    </ui:define>
</ui:composition>
